package com.zonhar.autofeed.controller;

import com.zonhar.autofeed.common.R;
import com.zonhar.autofeed.service.AutoFeedWeightService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 控制台报表
 */
@RestController
@RequestMapping("/dashBoard")
public class DashBoardController {

    @Autowired
    private AutoFeedWeightService autoFeedWeightService;

    /**
     * 获取状态栏数据
     * @return
     */
    @GetMapping("/getHeadStatusData")
    public R getHeadStatusData(){
        Map<String,Object> headStatusDataMap = autoFeedWeightService.getHeadStatusData();
        return R.ok().put("data",headStatusDataMap);
    }

    /**
     * 获取本周喂食情况报表数据报表数据
     * @return
     */
    @GetMapping("/getDashBoard")
    public R getDashBoard(){
        Map<String,Object> dashBoardMap = autoFeedWeightService.getDashBoard();
        return R.ok().put("data",dashBoardMap);
    }
}
